from django.contrib import admin
from test.models import Xyz
#from test.models import Cstt
#from test.models import Poll, Port, Choice
#from django.forms.models import ModelForm
#from django.db import models
#from django.forms import forms

class XyzAdmin(admin.ModelAdmin):
    def get_cc_root_only(self, obj):
        if self.username == "admin":
            return "CC"
        return "XXX"

    def changelist_view(self, request, extra_context=None):
        self.username = request.user.username
        return super(XyzAdmin,self).changelist_view(request, extra_context=extra_context)

    list_display = ("name", "get_cc_root_only")



#class PortAdmin(admin.ModelAdmin):
#    pass
#
#class CsttAdmin(admin.ModelAdmin):
#    pass
#
#class ChoiceInline(admin.TabularInline):
#    model = Choice
#    extra = 1
#
#class PollAdmin(admin.ModelAdmin):
#    inlines = [ChoiceInline]
#
#admin.site.register(Poll, PollAdmin)
#admin.site.register(Port, PortAdmin)
#admin.site.register(Cstt, CsttAdmin)
admin.site.register(Xyz, XyzAdmin)
